import request from '@/utils/request'
/**
 * @description: 获取角色列表
 * @param {*} params:{page 页码, pagesize 每页的条数}
 * @return {*}
 */
export function getRoleListAPI(params) {
  return request('/sys/role', { params })
}

export function addRoleAPI(data) {
  return request.post('/sys/role', data)
}

/**
 * @description: 获取角色详情
 * @param {*} params:{page 页码, pagesize 每页的条数}
 * @return {*}
 */
export function getRoleAPI(id) {
  return request(`/sys/role/${id}`)
}
export function ediRoleAPI(data) {
  return request.put(`/sys/role/${data.id}`, data)
}

export function delRoleAPI(id) {
  return request.delete(`/sys/role/${id}`)
}

// 给角色分配权限 {id:角色id, permIds:[] 所有选中的节点的id组成的数组}
export function assignPermAPI(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
